package cn.regexp.elasticjob.mapper;

import cn.regexp.elasticjob.domain.FileCustom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface FileCustomMapper {

    @Select("select * from t_file_custom where backedUp = 0")
    List<FileCustom> selectByBackupStatus();

    @Update("update t_file_custom set backedUp = 1 where id = #{id}")
    void changeStatus(Long id);

    @Select("select * from t_file_custom where backedUp = 0 and type = #{type}")
    List<FileCustom> selectByBackupStatusAndType(String type);
}
